/**
 * king
 */
package cn.scau.info.handler;

/**
 * @author king
 *
 */
public class RbfNetTest {
	public static void main(String[] args) {
		double[][] p1 = new double[][] { { 0 }, { 0.038461538 },
				{ 0.076923077 }, { 0.115384615 }, { 0.153846154 },
				{ 0.192307692 }, { 0.230769231 }, { 0.269230769 },
				{ 0.307692308 }, { 0.346153846 }, { 0.384615385 },
				{ 0.423076923 }, { 0.461538462 }, { 0.5 }, { 0.538461538 },
				{ 0.576923077 }, { 0.615384615 }, { 0.653846154 },
				{ 0.692307692 }, { 0.730769231 }, { 0.769230769 },
				{ 0.807692308 }, { 0.846153846 }, { 0.884615385 },
				{ 0.923076923 }, { 0.961538462 }, { 1 } };

		double[][] t1 = new double[][] { { 0 }, { 0.054515099 },
				{ 0.119537731 }, { 0.104881466 }, { 0.117110529 },
				{ 0.255848741 }, { 0.271001302 }, { 0.244713082 },
				{ 0.30148478 }, { 0.27489413 }, { 0.373463322 },
				{ 0.493543877 }, { 0.313928646 }, { 0.536062552 },
				{ 0.498315305 }, { 0.327042513 }, { 0.389761242 },
				{ 0.445748947 }, { 0.403273698 }, { 0.51538171 },
				{ 0.585780632 }, { 0.680678779 }, { 0.686087638 },
				{ 0.79165539 }, { 0.776608292 }, { 0.879523958 }, { 1 } };
		;

		double[] p2 = new double[] { 0.115384615 };

		RbfNet rbfNet = new RbfNet(1, 16, 1, p1);
		for (int i = 0; i < 10001; i++) {

			rbfNet.train(p1, t1, 27);

			if (i == 0) {
				System.out.println(String.valueOf(rbfNet.e));
				System.out.println(String.valueOf(rbfNet.d.length));
				System.out.println(String.valueOf(rbfNet.d[0]));
				System.out.println(String.valueOf(rbfNet.d[1]));
				System.out.println(String.valueOf(rbfNet.d[2]));
				int etime = (int) (150 / rbfNet.e);
				System.out.println(String.valueOf(etime));

			}
		}

		double[] t2 = rbfNet.sim(p2);

		System.out.println("---");
		for (int i = 0; i < t2.length; i++) {
			System.out.println(t2[i]);
		}
	}
}
